﻿using VSTalk.Engine.Core.ChatSession;
using VSTalk.Engine.Core.Disco;
using VSTalk.Model;

namespace VSTalk.Engine.ViewModel.Messenger.MessageBuilder
{
    public static class MessageBuilderFactory
    {
        public static IDiscoService DiscoService
        {
            get { return AppServices.Get<IDiscoService>(); }
        }

        public static IMessageBuilder Create(Room room)
        {
            return new TextMessageBuilder();
        }

        public static IMessageBuilder Create(IInterlocutorChatSession chatSession)
        {
            if (chatSession.ActiveResource != null && DiscoService.HasFeature(chatSession.ActiveResource, ExtUri.XAML))
            {
                return new XamlMessageBuilder();
            }
            return new TextMessageBuilder();
        }
    }
}